package org.easymodelers.gmf;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.easymodelers.modeler.data.ModelerDefinition;
import org.easymodelers.processing.ModelerUpdate;

public class GmfModelerCreationChain {
	private GmfPreModelsCreator preModelsCreator;
	private GmfGenModelCreator genModelCreator;
	private GmfGenModelUpdater genModelUpdater;
	private GmfDiagramPluginCreator diagramPluginCreator;
	private GmfDiagramPluginUpdater diagramPluginUpdater;

	public void createModeler(ModelerDefinition modeler) throws IOException {
		String modelPath = null;//modeler.get

		List<ModelerUpdate> updates = new ArrayList<ModelerUpdate>();

		//Creating graph, tool and map models
		List<ModelerUpdate> preModelsUpdates = preModelsCreator.createPreModels(modelPath, modeler);
		updates.addAll(preModelsUpdates);
		//Creating gen model
		genModelCreator.createGenModel(modelPath, modeler);
		
		//Updating gen model
		genModelUpdater.updateGenModel(modelPath, updates);

		//Creating diagram plugin
		diagramPluginCreator.createDiagramPlugin(modelPath, modeler);
		//Updating diagram plugin
		diagramPluginUpdater.updateDiagramPlugin(modelPath, updates);
	}

	public GmfPreModelsCreator getPreModelsCreator() {
		return preModelsCreator;
	}

	public void setPreModelsCreator(GmfPreModelsCreator preModelsCreator) {
		this.preModelsCreator = preModelsCreator;
	}

	public GmfGenModelCreator getGenModelCreator() {
		return genModelCreator;
	}

	public void setGenModelCreator(GmfGenModelCreator genModelCreator) {
		this.genModelCreator = genModelCreator;
	}

	public GmfGenModelUpdater getGenModelUpdater() {
		return genModelUpdater;
	}

	public void setGenModelUpdater(GmfGenModelUpdater genModelUpdater) {
		this.genModelUpdater = genModelUpdater;
	}

	public GmfDiagramPluginCreator getDiagramPluginCreator() {
		return diagramPluginCreator;
	}

	public void setDiagramPluginCreator(GmfDiagramPluginCreator diagramPluginCreator) {
		this.diagramPluginCreator = diagramPluginCreator;
	}

	public GmfDiagramPluginUpdater getDiagramPluginUpdater() {
		return diagramPluginUpdater;
	}

	public void setDiagramPluginUpdater(GmfDiagramPluginUpdater diagramPluginUpdater) {
		this.diagramPluginUpdater = diagramPluginUpdater;
	}

}
